<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/30
 * Time: 15:02
 */

namespace App\Services;

use App\UserGroup;
use App\GroupUser;
use App\User;
use Illuminate\Support\Facades\DB;

class GroupService
{
    public function getGroupList($cityId)
    {
        $field = [
            'user_groups.name',
            'user_groups.icon',
            'user_groups.volunteer_num',
        ];
        $where = array(
            'user_groups.city_id'  =>  $cityId
        );
        $str   = implode(',', $field);
        $list  = UserGroup::select(DB::raw($str))->where($where)->get()->toArray();
        return $list;
    }
}